![]() ![]() |
When multiple sites tied to different domain names are defined in the content structure and in web.config file, the cross links between the sites are generated incorrectly.
For example, the domain name is not taken into consideration and is substituted with the current one.
When making cross site links, the links to different site roots contain the site’s start item which is not expected. For example you may get a link href in the html like this:<a href="/SdnArchive/Root/Home/page01.html">Hi!</a> instead of <a href="/SdnArchive/page01.html">Hi!</a>.
The links that are generated using the <sc:link /> xsl control, have the unnecessary /sitecore/content, and the domains are not respected.
Note: the solution on this page is specific to Sitecore CMS 5.X, for Sitecore CMS 6.X solution please refer to the article Dynamic Links, namely the Rendering.SiteResolving setting.
Below we will describe the two ways to resolve this problem.
Download the code required for the solution.
1. Case 1 (without the home item)
![](/SdnArchive/upload/sdn5/articles%202/administration/multiple%20sites/internal%20links%201.png)
If your multiple sites solution does not include the Home item, you should use web.config definitions of such kind:
<!-- Funds Site -->
<site name="funds" hostName="funds.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/funds" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Insurance Site -->
<site name="insurance" hostName="insurance.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/insurance" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Capital Management Site -->
<site name="capital" hostName="capital.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/capital management" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Retirement Site -->
<site name="retirement" hostName="retirement.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/retirement" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Corporate Site -->
<site name="corporate" hostName="company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/corporate" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
The contentStartItem for the shell site should be renamed from “/Home” (default) to “/” so the resulting path (rootPath + contentStartItem) is “/sitecore/content”. This is necessary in order to eliminate the “context links”. If the contentStartItem is set to one of the custom sites, then linking to this site from the rich text field will produce an empty “/” href attribute.
<site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell" rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" loginPage="/sitecore/login" content="master" contentStartItem="/" enableWorkflow="true" xmlControlPage="/sitecore/shell/default.html" browserTitle="Sitecore" />
The startItem attribute should be left intact since this parameter is used for the core database as well: startItem="/home".
2. Case 2 (with the home item)
![](/SdnArchive/upload/sdn5/articles 2/administration/multiple sites/internal links 2.png)
This approach is easier since it requires less customization in web.config, for example the shell site should be left intact.
<site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell" rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" loginPage="/sitecore/login" content="master" contentStartItem="/home" enableWorkflow="true" xmlControlPage="/sitecore/shell/default.html" browserTitle="Sitecore" />
The custom sites should point to appropriate root path: "/sitecore/content/home".
<!-- Funds Site -->
<site name="funds" hostName="funds.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/home" startItem="/funds" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Insurance Site -->
<site name="insurance" hostName="insurance.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/home" startItem="/insurance" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Capital Management Site -->
<site name="capital" hostName="capital.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/home" startItem="/capital management" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Retirement Site -->
<site name="retirement" hostName="retirement.company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/home" startItem="/retirement" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- Corporate Site -->
<site name="corporate" hostName="company.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/home" startItem="/corporate" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
![](/SdnArchive/images/sdn5/prev.gif)
![](/SdnArchive/images/sdn5/next.gif)